<template>
  <el-container class="home-container">
    <el-header>
      <div class="logo-box">
        <img src="../../assets/img/heima.png" alt="">
        <span>电商后台管理系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <el-container>
      <el-aside :width="collapse?'64px':'200px'">
        <div class="togglebar" @click="collapse=!collapse">
          |||
        </div>
        <el-menu background-color="#333744" text-color="#fff" active-text-color="#409EFF" unique-opened :collapse="collapse" :collapse-transition="false" :router="true">
          <!-- 子菜单 -->
          <el-submenu :index="item.id+''" v-for="(item,i) in menulist" :key="item.id" :style="collapse?'width:64px':'width:200px'">
            <template slot="title">
              <i :class="['iconfont',iconclass[i]]"></i>
              <span>{{item.authName}}</span>
            </template>
            <!-- 子菜单的 Item 项 -->
            <el-menu-item :index="'/'+subitem.path" v-for="subitem in item.children" :key="subitem.id">
              <i class="el-icon-menu"></i>
              <span>{{subitem.authName}}</span>
            </el-menu-item>
          </el-submenu>
        </el-menu>git
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import mix from './home-mixins'
export default {
  mixins: [mix]
}
</script>

<style lang="less" scoped>
.home-container {
  height: 100%;
  .el-header {
    background-color: #373d41;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    padding-right: 20px;
    .logo-box {
      display: flex;
      color: white;
      font-size: 22px;
      align-items: center;
      // 禁止被用户选中
      user-select: none;
      img {
        width: 50px;
        height: 50px;
        margin-right: 10px;
      }
    }
  }

  .el-aside {
    background-color: #333744;
    user-select: none;
  }

  .el-main {
    background-color: #eaedf1;
  }
}
.togglebar {
  color: #fff;
  text-align: center;
  line-height: 25px;
  font-size: 12px;
  background-color: #4a5064;
  user-select: none;
  cursor: pointer;
  letter-spacing: 0.1em;
}
</style>
